Published 2011-12-15 00:00:00
/**
* GET method Roo/TABLENAME
*
* Generally for SELECT or Single SELECT
*
* Single SELECT:
* _id=value single fetch based on primary id.
* lookup[key]=value single fetch based on a single key value lookup.
* multiple key/value can be used. eg. ontable+onid..
* _columns what to return.
*
*
* Search SELECT
* COLUMNS to fetch
* _columns=a,b,c,d comma seperated list of columns.
* _distinct=name a distinct column lookup.
*
* WHERE
* !colname=.... => colname != ....
* !colname[0]=... !colname[1]=... => colname NOT IN (.....) ** only supports main table at present..
* colname[0]=... colname[1]=... => colname IN (.....) ** only supports main table at present..
*
* ORDER BY
* sort=name what to sort.
* sort=a,b,d can support multiple columns
* dir=ASC what direction
* _multisort ={...} JSON encoded { sort : { row : direction }, order : [ row, row, row ] }
*
* LIMIT
* start=0 limit start
* limit=25 limit number
*
*
* Simple CSV support
* csvCols[0] csvCols[1].... = .... column titles for CSV output
* csvTitles[0], csvTitles[1] .... = columns to use for CSV output
*
* Depricated
* _toggleActive !:!:!:! - this hsould not really be here..
* query[add_blank] - add a line in with an empty option... - not really needed???
*
* DEBUGGING
* _post = simulate a post with debuggin on.
* _delete = delete a list of ids element. (depricated.. this will be removed...)
*
*
*
* CALLS methods on dataobjects if they exist
* checkPerm('S' , $authuser)
* - can we list the stuff
* - return false to disallow...
* applySort($au, $sortcol, $direction, $array_of_columns, $multisort)
* -- does not support multisort at present..
* applyFilters($_REQUEST, $authUser, $roo)
* -- apply any query filters on data. and hide stuff not to be seen.
* -- can exit by calling $roo->jerr()
* postListExtra($_REQUEST) : array(extra_name => data)
* - add extra column data on the results (like new messages etc.)
* postListFilter($data, $authUser, $request) return $data
* - add extra data to an object
*
* toRooSingleArray($authUser, $request) : array
* - called on single fetch only, add or maniuplate returned array data.
* toRooArray($request) : array
* - called if singleArray is unavailable on single fetch.
* - always tried for mutiple results.
* autoJoin($request)
* - standard DataObject feature - causes all results to show all
* referenced data.
*/
/**
* POST method Roo/TABLENAME
* -- INSERTs, UPDATEs, or DELETEs data.
*
* INSERT
* if the primary key is empty, this happens
* will automatically set these to current date and authUser->id
* created, created_by, created_dt
* updated, update_by, updated_dt
* modified, modified_by, modified_dt
*
* will return a GET request SINGLE SELECT (and accepts same)
*
* DELETE
* _delete=1,2,3 delete a set of data.
* UPDATE
* if the primary key value is set, then update occurs.
* will automatically set these to current date and authUser->id
* updated, update_by, updated_dt
* modified, modified_by, modified_dt
*
*
* Params:
* _delete=1,2,3 causes a delete to occur.
* _ids=1,2,3,4 causes update to occur on all primary ids.
*
* RETURNS
* = same as single SELECT GET request..
*
*
*
* DEBUGGING
* _debug=1 forces debug
* _get=1 - causes a get request to occur when doing a POST..
*
*
* CALLS
* these methods on dataobjects if they exist
*
* checkPerm('E' / 'D' , $authuser)
* - can we list the stuff
* - return false to disallow...
* toRooSingleArray($authUser, $request) : array
* - called on single fetch only, add or maniuplate returned array data.
* toRooArray($request) : array
* - Called if toSingleArray does not exist.
* - if you need to return different data than toArray..
*
* toEventString()
* (for logging - this is generically prefixed to all database operations.)
*
*
* onUpload($roo)
* called when $_FILES is not empty
*
*
* setFromRoo($ar, $roo)
* - alternative to setFrom() which is called if this method does not exist
* - values from post (deal with dates etc.) - return true|error string.
* - call $roo->jerr() on failure...
*
* CALLS BEFORE change occurs:
*
* beforeDelete($dependants_array, $roo)
* Argument is an array of un-find/fetched dependant items.
* - jerr() will stop insert.. (Prefered)
* - return false for fail and set DO->err;
*
* beforeUpdate($old, $request,$roo)
* - after update - jerr() will stop insert..
* beforeInsert($request,$roo)
* - before insert - jerr() will stop insert..
*
* CALLS AFTER change occured
*
* onUpdate($old, $request,$roo)
* - after update // return value ignored
*
* onInsert($request,$roo)
* - after insert
*
*
*
*/